using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAL;

namespace BUS
{
    public class StatusBUS
    {
        public static void Insert(tbStatus status)
        {
            StatusDAL statusdal = new StatusDAL();
            statusdal.Insert(status);
        }
        public static void Update(tbStatus status)
        {
            StatusDAL statusdal = new StatusDAL();
            statusdal.Update(status);
        }
        public static void Delete(int iD)
        {
            StatusDAL statusdal = new StatusDAL();
            statusdal.Delete(iD);
        }
        public static tbstatuscolection GET(string Where, int PageIndex, int PageSize,
                                        string OrderBy, string OrderDirection,
                                        out int TotalRecords)
        {
            StatusDAL statusdal = new StatusDAL();
            return statusdal.GET(Where, PageIndex, PageSize,
                            OrderBy, OrderDirection, out TotalRecords);
        }
        public static tbStatus GetByID(int iD)
        {
            int t = 0;
            StatusDAL statusdal = new StatusDAL();
            tbstatuscolection tbstatuscolection = statusdal.GET("where " + tbstatusColumn.idstatus.ToString() + " = " + iD.ToString(), 0, 0,
                tbstatusColumn.status.ToString(), "ASC", out t);
            if (tbstatuscolection.Count == 1)
                return tbstatuscolection[0];
            return null;
        }
        public static tbstatuscolection GetAll()
        {
            int t = 0;
            StatusDAL statusdal = new StatusDAL();
            return statusdal.GET("where 1=1", 0, 10,
                tbstatusColumn.status.ToString(), "ASC", out t);
        }
    }
}
